<template>
  <div class="Carousel">
    <el-carousel ref="carousel" :interval="5000" arrow="always">
      <el-carousel-item v-for="item in imgLists" :key="item.id" name="item.id">
        <img :src="item.img" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
export default {
  props: ['imgLists', 'imgId'],
  watch: {
    imgId(val) {
      this.setActiveItem(val)
    }
  },
  methods: {
    setActiveItem(index) {
      this.$refs.carousel.setActiveItem(index)
    }
  }
}
</script>
<style lang="scss" scoped>
.Carousel {
  ::v-deep .el-carousel--horizontal,
  .el-carousel__item {
    height: 600px;
    img {
      height: 600px;
    }
  }
  ::v-deep .el-carousel__arrow {
    margin-top: 150px;
  }
}
</style>
